<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
//前端路由
Route::group(['namespace' => 'Index'], function () {
    Route::match(['get'], '/{id?}', 'Index@index')->where(['id' => '[0-9]+']);
    Route::match(['get'], 'info/{id}', 'Index@info');
    Route::match(['get', 'post'], 'register', 'Index@register');
    Route::match(['get', 'post'], 'login', 'Index@login');
    Route::match(['post'], 'loginout', 'Index@loginout');
    Route::match(['post'], 'comm', 'Index@comm');
    Route::match(['get'], 'search', 'Index@search');
});


//后端路由
Route::group(['prefix' => 'admin', 'namespace' => 'Admin'], function () {
    Route::match(['get', 'post'], '/', 'Index@login');
    Route::match(['get', 'post'], 'register', 'Index@register');
    Route::match(['get', 'post'], 'forget', 'Index@forget');
    Route::match(['post'], 'reset', 'Index@reset');

    Route::group(['middleware' => 'admin.login'], function () {
        Route::match(['get'], 'index', 'Home@index');
        Route::match(['post'], 'loginout', 'Home@loginout');
        Route::match(['get'], 'adminlist', 'Admin@all');
        Route::match(['post'], 'adminstatus', 'Admin@status');
        Route::match(['get', 'post'], 'adminadd', 'Admin@add');
        Route::match(['get', 'post'], 'adminedit/{id?}', 'Admin@edit');
        Route::match(['post'], 'admindel', 'Admin@del');
        Route::match(['get'], 'memberlist', 'Member@all');
        Route::match(['get', 'post'], 'memberadd', 'Member@add');
        Route::match(['get', 'post'], 'memberedit/{id?}', 'Member@edit');
        Route::match(['post'], 'memberdel', 'Member@del');
        Route::match(['get'], 'catelist', 'Cate@all');
        Route::match(['get', 'post'], 'cateadd', 'Cate@add');
        Route::match(['post'], 'catesort', 'Cate@sort');
        Route::match(['get', 'post'], 'cateedit/{id?}', 'Cate@edit');
        Route::match(['post'], 'catedel', 'Cate@del');
        Route::match(['get'], 'articlelist', 'Article@all');
        Route::match(['get', 'post'], 'articleadd', 'Article@add');
        Route::match(['post'], 'articleup', 'Article@up');
        Route::match(['post'], 'articleTop', 'Article@top');
        Route::match(['get', 'post'], 'articleadd', 'Article@add');
        Route::match(['get', 'post'], 'articleedit/{id?}', 'Article@edit');
        Route::match(['post'], 'articledel', 'Article@del');
        Route::match(['get'], 'commentlist', 'Comment@all');
        Route::match(['post'], 'commentdel', 'Comment@del');
        Route::match(['get', 'post'], 'system', 'System@info');
    });
});